<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../include/admincontent.jsp" %>
<div id="location">当前位置：面试管理 > 评价表管理</div>
<!-- 筛选条件 -->
<div id="Content" class="bg-content">
    <div class="toolbars" style="height:30px;white-space:nowrap;width:auto;margin-left: 20px;" totalwidth="314">
        <a id="baseevaluation_add">
            <em id="add_em" class="ico16 add_new"></em>
            <span id="send_span" class="menu_span" title="添加评价表">添加评价表</span>
        </a>
        <a id="baseevaluation_edit">
            <em class="ico16 editor_16"></em>
            <span class="menu_span" title="修改评价表">修改评价表</span>
        </a>
        <a id="baseevaluation_del">
            <em class="ico16 del_16"></em>
            <span class="menu_span" title="删除评价表">删除评价表</span>
        </a>
        <a id="baseevaluation_view">
            <em class="ico16 preview_16"></em>
            <span class="menu_span" title="查看评价表">查看评价表</span>
        </a>
    </div>
</div>
<table class="treeTable" id="tablelist" lay-filter="examTable"></table>
<script type="text/javascript">
    $(document).ready(function () {
        //getList();

        //添加评价表
        $('#baseevaluation_add').click(function () {
            openLayer('添加评价表', '/BaseEvaluation/add', '98%', '98%');
        });
        //修改评价表
        $('#baseevaluation_edit').click(function () {
            //EditInfo('修改评价表', '/BaseEvaluation/edit?_x=2015', '98%', '98%');
            var url = '/BaseEvaluation/edit?_x=2015';

            var id = '';
            var checkRows = layui.table.checkStatus('baseIndexTable').data;
            var count = checkRows.length;

            if (count < 1) {
                layer.msg('请选择一条信息',{icon:7,time:2000});
            } else if (count > 1) {
                layer.msg('只能选择一条信息',{icon:7,time:2000});
            } else {
                $(checkRows).each(function (index, itme) {
                    id = itme.ids.replace('cb_', '');
                });
                openLayer('修改考官信息', url + '&id=' + id, '98%', '98%');
            }
        });
        //删除评价表
        $('#baseevaluation_del').click(function () {
            //DelInfo('/BaseEvaluation/DelAction');
            var checkRows = layui.table.checkStatus('baseIndexTable').data;
            var id = '';
            var count = checkRows.length;

            if (count < 1) {
                layer.msg('请选择一条信息',{icon:7,time:2000});
            } else if (count > 1) {
                layer.msg('只能选择一条信息',{icon:7,time:2000});
            } else {
                $(checkRows).each(function (index, itme) {
                    id = itme.ids.replace('cb_', '');
                });
                $.post("/BaseEvaluation/DelAction", {id: id}, function (result) {
                    if (result.state) {
                        layer.alert(result.Message, {icon: 1});
                        //getList();
                        tavkeIns.reload('examIndexTable', {
                            page: {
                                curr: 1
                            }
                        });
                    } else {
                        layer.alert(result.Message, {icon: 2});
                    }
                }, "JSON");
            }
        });
        //查看评价表
        $('#baseevaluation_view').click(function () {
            //EditInfo('查看评价表', '/BaseEvaluation/view?_x=2015', '98%', '98%');
            var url = '/BaseEvaluation/view?_x=2015';

            var id = '';
            var checkRows = layui.table.checkStatus('baseIndexTable').data;
            var count = checkRows.length;

            if (count < 1) {
                layer.msg('请选择一条信息',{icon:7,time:2000});
            } else if (count > 1) {
                layer.msg('只能选择一条信息',{icon:7,time:2000});
            } else {
                $(checkRows).each(function (index, itme) {
                    id = itme.ids.replace('cb_', '');
                });
                openLayer('查看考官信息', url + '&id=' + id, '98%', '98%');
            }
        });
    });

    var tavkeIns;
    let layuithis;
    layui.use('table',function () {
        var table = layui.table;
        layuithis = this;

        tavkeIns = table.render({
            id:'baseIndexTable',
            elem:'#tablelist',
            url: '/BaseEvaluation/getlistsLayuiJson',
            title:'数据表',
            height:'full',
            cols:[[
                {type:'checkbox',fixed:'left'},
                {field:'id',title:'ID',fixed:'left',sort:true,width:180},
                {field: 'name',title: '评价表名称',fixed: 'left',sort: true}
            ]],
            page:true
        });
    });

    function getList() {
        getAjax('/BaseEvaluation/getlists', null, function (data) {
            $("#result").html(data);
        });
    }
</script>
</body>
</html>